PreviousValue (fld) and Previous are equivalent functions. However, you can use Previous only with Crystal syntax, and PreviousValue only with Basic syntax.
fld is any valid database or formula field in the report.
A field value of the same type that was passed as the fld argument.
Previous (fld) returns the value of the specified field in the previous record.
You can use previous to identify the last record in a previous range or the last record occurring before a new range begins, or to test for duplicate values.
The following examples are applicable to Crystal syntax:
If Previous({file.QTY}) <> 0 Then
Tests the previous value in the {file.QTY} field to see if it is a zero value. If it is not, it divides the value by two. If it is a zero value, it returns the value itself.
If Previous ({customer.CUSTOMER ID}) = {customer.CUSTOMER ID} Then
This flags repeated values in the {customer.CUSTOMER ID} field.
If Remainder(Previous ({file.SERIALNUM}), 300) = 0 Then
Divides the previous value in the {file.SERIALNUM} field by 300. If there is no remainder, it flags the current value as "Beginning, new block". If there is a remainder (Else) it prints no flag. (This formula divides serial numbers into blocks of 300.)
Note: Using this function in a formula forces the formula to be evaluated at print time. For more information on evaluation time considerations, see Evaluation Time functions.
Seagate Software IMG Holdings, Inc. http://www.seagatesoftware.com Support services: http://support.seagatesoftware.com |